Skip to content

fix(components): Divider accessibility defaults can't be overridden - #224

Merged
Chibuzor-Nwemambu merged 1 commit into
mainfrom
219-divider-allow-overriding-bug
Jul 9, 2026
Merged

fix(components): Divider accessibility defaults can't be overridden#224
Chibuzor-Nwemambu merged 1 commit into
mainfrom
219-divider-allow-overriding-bug

Conversation

@Chibuzor-Nwemambu

Copy link
Copy Markdown
Collaborator

Summary

  • Divider.tsx spread {...rest} after its accessible={false} / importantForAccessibility="no" defaults, so a caller passing either prop explicitly could override Divider's "hidden from assistive technology" behavior.
  • Reordered so the component's own defaults always win, since Divider is purely decorative and no legitimate use case was found for making it independently accessible/focusable — same reasoning as the disabled merge fix in fix(components): make component's own disabled state win accessibilityState merges #221 for Button/IconButton/Input/TextArea.
  • Added a regression test asserting accessible/importantForAccessibility can't be overridden via props.

Fixes #219

Test plan

  • pnpm jest Divider — 4/4 pass
  • pnpm lint — clean
  • pnpm check-types — clean
  • pnpm prettier --check — clean

…r caller props

Divider spread {...rest} after its accessible/importantForAccessibility
defaults, so a caller could unintentionally override a purely decorative
element's "hidden from assistive technology" behavior. Reorder so the
component's own defaults always win, matching the disabled-state fix
already applied to Button/IconButton/Input/TextArea.

Fixes #219
@Chibuzor-Nwemambu

Copy link
Copy Markdown
Collaborator Author

@claude review

@claude

claude Bot commented Jul 8, 2026

Copy link
Copy Markdown

Claude finished @Chibuzor-Nwemambu's task in 53s —— View job


Review: PR #224 — Divider accessibility defaults can't be overridden

  • Gather context (diff, files)
  • Analyze the fix and test
  • Post review feedback

Verdict: LGTM. The fix is correct, minimal, and well-targeted. ✅

The fix

<View
    style={[styles.divider, style]}
    {...rest}
    accessible={false}
    importantForAccessibility="no"
/>

Moving {...rest} above the accessibility props is exactly right — in JSX, later props win, so the component's own defaults now always take precedence over anything a caller spreads in. This resolves #219.

The approach is also consistent with existing code in the package: Search.tsx already places {...rest} (line 166) before its hardcoded accessible={false} / importantForAccessibility="no" (lines 198–225), so this brings Divider in line with the established pattern.

The test

The regression test (Divider.test.tsx:25–36) is on point — it passes accessible={true} and importantForAccessibility="yes" and asserts both are still forced to the hidden values, directly locking in the intended behavior. Good coverage.

Non-blocking observations

  1. Type honesty (minor). DividerProps = ViewProps still advertises accessible and importantForAccessibility as settable props, but they are now silently ignored. A caller reading only the types wouldn't know their value has no effect. If you want the type to reflect reality, you could narrow it:

    export type DividerProps = Omit<ViewProps, "accessible" | "importantForAccessibility">;

    I'd treat this as optional — the sibling components (Search, TextArea) don't do this either, so leaving it keeps things uniform. Worth a line on the #152 tracking issue if you want to standardize the whole set later rather than one-off here.

  2. importantForAccessibility is Android-only, and accessible={false} covers iOS — so the two together correctly hide the decorative divider on both platforms. No action needed; just confirming the pair is intentional and complete.

Nice, tightly-scoped fix with a matching regression test. 👍
· 219-divider-allow-overriding-bug

@pomfrida pomfrida left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Chibuzor-Nwemambu
Chibuzor-Nwemambu merged commit 9873283 into main Jul 9, 2026
7 checks passed
@Chibuzor-Nwemambu
Chibuzor-Nwemambu deleted the 219-divider-allow-overriding-bug branch July 9, 2026 09:21
@github-actions github-actions Bot mentioned this pull request Jul 9, 2026
pomfrida added a commit that referenced this pull request Aug 4, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>eds-mobile-components: 0.3.1</summary>

##
[0.3.1](eds-mobile-components-v0.3.0...eds-mobile-components-v0.3.1)
(2026-07-09)


### Bug Fixes

* **components:** Divider accessibility defaults can't be overridden
([#224](#224))
([9873283](9873283))
* **components:** make component's own disabled state win
accessibilityState merges
([#221](#221))
([ed5d78d](ed5d78d))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Frida Erdal <31915755+pomfrida@users.noreply.github.com>
Chibuzor-Nwemambu pushed a commit to equinor/design-system that referenced this pull request Aug 7, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>eds-mobile-components: 0.3.1</summary>

##
[0.3.1](equinor/design-system-mobile@eds-mobile-components-v0.3.0...eds-mobile-components-v0.3.1)
(2026-07-09)


### Bug Fixes

* **components:** Divider accessibility defaults can't be overridden
([#224](equinor/design-system-mobile#224))
([9873283](equinor/design-system-mobile@9873283))
* **components:** make component's own disabled state win
accessibilityState merges
([#221](equinor/design-system-mobile#221))
([ed5d78d](equinor/design-system-mobile@ed5d78d))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Frida Erdal <31915755+pomfrida@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Divider (and possibly other components) allow overriding accessible/importantForAccessibility defaults via spread props

2 participants